﻿using iMES.Core.BaseProvider;
using iMES.Core.EFDbContext;
using iMES.Core.Extensions.AutofacManager;
using iMES.Entity.DomainModels;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using YUN.ProductionManage.IRepositories;

namespace YUN.ProductionManage.Repositories
{
    public partial class Product_ProductOrderLIstRepository : RepositoryBase<OrderProductList>, IProduct_ProductOrderListRepository
    {
        public Product_ProductOrderLIstRepository(SysDbContext dbContext)
        : base(dbContext)
        {

        }
        public static IProduct_ProductOrderListRepository Instance
        {
            get { return AutofacContainerModule.GetService<IProduct_ProductOrderListRepository>(); }
        }
        public async Task<List<OrderProductList>> GetOrderDetailsByIdAsync(Guid productionOrderId)
        {
            // 异步查询 ProductionOrderInfo 数据
            var order = await this.FindAsync(x => x.ProductionOrderId == productionOrderId);

            // 如果订单存在，返回其明细数据
            return order ?? new List<OrderProductList>();
        }
    }
}
